home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970626-19970929 / 000268_news@newsmaster….columbia.edu _Sat Aug 30 18:20:26 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id SAA07754
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Sat, 30 Aug 1997 18:20:25 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id SAA08529
  7.     for kermit.misc@watsun; Sat, 30 Aug 1997 18:20:24 -0400 (EDT)
  8. Path: news.columbia.edu!panix!cam-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!cs.utexas.edu!news.cs.utah.edu!cc.usu.edu!jrd
  9. From: jrd@cc.usu.edu (Joe Doupnik)
  10. Newsgroups: comp.protocols.kermit.misc
  11. Subject: Re: Two problems with arrays in MS-DOS Kermit 3.15
  12. Message-ID: <cJQy1iveLABq@cc.usu.edu>
  13. Date: 30 Aug 97 15:37:54 MDT
  14. References: <34085a7f.81052@news.calvacom.fr>
  15. Organization: Utah State University
  16. Lines: 61
  17. Xref: news.columbia.edu comp.protocols.kermit.misc:7585
  18.  
  19. In article <34085a7f.81052@news.calvacom.fr>, do11@calva.net (Dominique Ottello) writes:
  20. > Sorry, I don't want to take out a season-ticket to this group but.... ;-)
  21. > I discovered two problems with arrays (\&<letter>[]) :
  22. > First : declare \&e[0] does not empty the last element.
  23.  
  24.     It does, but the last element is index value (array size - 1).
  25. That is, like C, elements start with subscript/index 0.
  26.  
  27. > declare \&d[5]
  28.  
  29.     Declares an array of five elements, \&d[0]..\&d[4].
  30.  
  31. > for \%i 1 5 1 {def \&d[\%i] No}
  32.  
  33.     Does nothing with last element (out of bounds)
  34.  
  35. > for \%i 1 5 1 {echo \%i - (\&d[\%i])}
  36. > ;
  37. > echo {Element 4 and 5 must be empty with declare \\&d[0]}
  38. > declare \&d[0]
  39. > declare \&d[5]
  40. > for \%i 1 3 1 {def \&d[\%i] Ys}
  41. > for \%i 1 5 1 {echo \%i - (\&d[\%i])}
  42. > ;
  43. > echo {Element 5 is empty with def \\&d[5]}
  44. > def \&d[5]
  45. > for \%i 1 5 1 {echo \%i - (\&d[\%i])}
  46. > Second : writing an empty array element into a file does very strange
  47. > things and can crash the system
  48.  
  49.     Yup, and that's another bug which was fixed in the previous message,
  50. though not mentioned there.
  51.  
  52. > ; Save this into a take file myfile.tak
  53. > ; Launch Kermit 3.15
  54. > ; Type take myfile.tak
  55. > ; and the system crash if the last element of the array is empty
  56. > ;
  57. > declare \&e[5]
  58. > for \%i 1 4 1 {def \&e[\%i] No}
  59. > open write file Test.dat
  60.  
  61.     Syntax error: OPEN WRITE filename. Your filename is FILE here.
  62.  
  63. > write file \&e[1]\13\10
  64. > write file \&e[2]\13\10
  65. > write file \&e[3]\13\10
  66. > write file \&e[4]\13\10
  67. > write file \&e[5]\13\10
  68. > close write-file
  69. > Comments please.
  70. > Best regards,
  71. > == Dominique Ottello == do11@calva.net == Paris == France ==
  72.  
  73.     Thanks, appreciated.
  74.     Joe D.